(function(){"use strict";BX.namespace("BX.Landing");var t=BX.Landing.Utils.proxy;var e=BX.Landing.Utils.bind;BX.Landing.TemplateTeaser=function(e){this.ajaxUrl=e.ajaxUrl;this.ajaxParams={};this.texts=e.texts;this.counter=0;this.buttonForm=document.querySelector('[data-role="landing-sm-form"]');this.createButton=document.querySelector('[data-role="landing-sm-create"]');this.loaderTextContainer=document.querySelector('[data-role="landing-sm-teaser-loader"]');this.progressBar=null;this.onCreateButtonClick=t(this.onCreateButtonClick,this);this.onRandomLoaderNext=t(this.onRandomLoaderNext,this);this.init();return this};BX.Landing.TemplateTeaser.getInstance=function(t){return BX.Landing.TemplateTeaser.instance||(BX.Landing.TemplateTeaser.instance=new BX.Landing.TemplateTeaser(t))};BX.Landing.TemplateTeaser.prototype={init:function(){this.ajaxParams["start"]="Y";this.ajaxParams["showcaseId"]="fashion";e(this.createButton,"click",this.onCreateButtonClick)},onCreateButtonClick:function(t){t.preventDefault();this.createButton.classList.add("landing-sm-teaser-button--load");var e=new BX.Loader({target:document.querySelector(".landing-sm-teaser-button"),size:40});e.show();this.randomLoader();this.createCatalog()},createCatalog:function(){if(this.ajaxUrl===""){return}BX.ajax({method:"POST",dataType:"json",url:this.ajaxUrl,data:BX.ajax.prepareData(this.ajaxParams),onsuccess:BX.proxy(this.createCatalogResult,this)})},createCatalogResult:function(t){if(t.status==="continue"){this.ajaxParams["start"]="N";this.createCatalog()}else{this.finalRedirectAjax()}},finalRedirectAjax:function(){this.buttonForm.submit()},randomLoader:function(){this.counter=0;BX.cleanNode(this.loaderTextContainer);this.loaderTextContainer.appendChild(BX.create("span",{props:{className:"landing-sm-teaser-loader--show"},text:this.texts[this.counter]}));setInterval(this.onRandomLoaderNext,3e3)},onRandomLoaderNext:function(){this.counter++;this.counter===this.texts.length?this.counter=0:null;BX.cleanNode(this.loaderTextContainer);this.loaderTextContainer.appendChild(BX.create("span",{props:{className:this.counter===3?"landing-sm-teaser-loader--show landing-sm-teaser-loader--without-dotted":"landing-sm-teaser-loader--show"},text:this.texts[this.counter]}))}}})();
//# sourceMappingURL=script.map.js